package com.company.project.web;

import com.company.project.service.UserHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerResponse;

import static org.springframework.web.reactive.function.server.RequestPredicates.GET;

/**
 * @Author: 陶鹏飞
 * @Description:
 * @Date: 2018/12/28-19:48
 * @email: taopengfei1223@foxmail.com
 **/
@Configuration
public class UserRouter {

    @Autowired
    private UserHandler userHandler;

    @Bean
    public RouterFunction<ServerResponse> routeCity(){
        return RouterFunctions.route(GET("/user").and(RequestPredicates.accept(MediaType.TEXT_PLAIN)),userHandler::sayGood)
//                .andRoute(GET("/date"),userHandler::getDate);
//                .andRoute(GET("/time"),cityHandler::getTime)
                .andRoute(GET("/getAll"),userHandler::getAlll);
//                .andRoute(GET("/create"),cityHandler::create)
//                .andRoute(GET("/delete"),cityHandler::delete);
    }
}
